package com.google.code.irouter.portal.client.dashboard.main.center.managers.library.browser.consumer.command.switcher;

import com.google.code.irouter.portal.client.dashboard.main.center.managers.library.Browser;
import com.google.code.irouter.portal.client.dashboard.main.center.managers.library.browser.Guide;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.core.Ext;
import com.gwtext.client.widgets.menu.BaseItem;
import com.gwtext.client.widgets.menu.Menu;
import com.gwtext.client.widgets.menu.event.MenuListenerAdapter;

public final class ModeListener extends MenuListenerAdapter {

	@Override
	public void onClick(Menu menu, String menuItemId, EventObject e) {
		BaseItem item = menu.getItem(menuItemId);
		Browser browser = (Browser) Ext.getCmp(Browser.class.getName());
		if(item.getStateId().equals("0")) {
			browser.setActiveItem(0);
			((Guide) Ext.getCmp(Guide.class.getName())).refresh();
		}
    }
}
